/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import java.io.IOException;
import javax.wireless.messaging.*;
import javax.microedition.io.*;
/**
 *
 * @author Eduardo Cerritos
 */
public class Conexion {

    private static MessageConnection conn;
    private static TextMessage txtmessage;

    static void enviarMensaje(String numTelefono, String msgString){
        try {
            conn = (MessageConnection) Connector.open("sms://" + numTelefono + ":1234");
            txtmessage = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE);
            txtmessage.setPayloadText(msgString);
            conn.send(txtmessage);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }


}
